package com.rwdesign.springboot.Waimai.service.Impl;

import com.rwdesign.springboot.Waimai.dao.OrderMapper;
import com.rwdesign.springboot.Waimai.entity.Order;
import com.rwdesign.springboot.Waimai.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author rystart
 * @create 2022-01-29 12:39
 */
@Service
@Slf4j
public class OrderServiceImpl implements OrderService {

    @Resource
    private OrderMapper orderMapper;

    @Override
    public List<Order> selectAllOrders(String orderStatus, Integer userId) {
        return orderMapper.selectAllOrders(orderStatus, userId);
    }

    /**
     * @return
     * @Author chendanping
     * @Description //TODO 查詢商户訂單
     * @Date 21:02 2022/3/2
     * @Param
     **/
    @Override
    public List<Order> selectShoperOrdersById(String orderStatus, Integer shopId) {
        return orderMapper.selectAllOrders(orderStatus, shopId);
    }

    @Override
    public int insertOrder(Order record) {
        return orderMapper.insertOrder(record);
    }


    /**
     * @return
     * @Author chendanping
     * @Description //TODO 结束訂單
     * @Date 21:10 2022/3/2
     * @Param
     **/
    public int updateOrderEndTimeById(String orderStatus, String orderEndTime, Integer orderId) {
        return orderMapper.updateOrderEndTimeById(orderStatus,orderEndTime, orderId);
    }


}
